package com.zf.yichat.api.config.Component;

import com.zf.yichat.mapper.PacketMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * 红包相关组件
 */
@Component
public class PacketComponent {


    @Autowired
    private PacketMapper packetMapper;


    /**
     * 根据红包ID查询已领取个数
     * @param packetId
     * @return
     */
    public Integer queryReceivedNum(Long packetId){
        return packetMapper.countReceiveCount(packetId);
    }

    /**
     * 根据红包ID查询已领取金额
     * @param packetId
     * @return
     */
    public BigDecimal queryReceivedMoney(Long packetId){
        return  packetMapper.queryReceivedMoney(packetId);
    }

}
